package controller;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import model.User;
import service.UserService;

@Controller
public class UserController {

	@Autowired
	private UserService userService;
	
	@RequiresPermissions("user:query")
	@RequestMapping(value="/users")
	public ModelAndView list() {
		ModelAndView view = new ModelAndView("usersList");
		List<User> users = userService.findPage();
		view.addObject("users", users);
		return view;
	}
	
}
